﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Threading;

namespace CoreRay.Client
{
    public class LogWindowReceiver : LogReceiver
    {
        private LogWindow logWindow;

        public LogWindowReceiver(LogWindow logWindow)
        {
            this.logWindow = logWindow;
        }

        public override void Write(string message, string category, LogInformationTypes messageInformationType)
        {
            this.logWindow.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (DispatcherOperationCallback)delegate(object arg)
            {
                this.logWindow.WriteLog(message, category, messageInformationType);

                return null;
            }, null);   
        }
    }
}
